//
//  WeHomePageHotCell.m
//  WeGalaxy
//
//  Created by Zheng on 2017/7/18.
//  Copyright © 2017年 Zheng. All rights reserved.
//

#import "WeHomePageHotCell.h"

@implementation WeHomePageHotCell

#pragma mark - 子视图
- (void)subviewsInContentView {
    [self.contentView addSubview:self.iconImgv];
    [self.contentView addSubview:self.titleLbl];
    [self.contentView addSubview:self.priceLbl];
    [self.contentView addSubview:self.numbersLbl];
    [self.contentView addSubview:self.fiIconImgv];
    [self.contentView addSubview:self.timeLbl];
    
    [_iconImgv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(7);
        make.width.height.mas_equalTo(70);
        make.centerY.equalTo(self);
    }];
    
    [_titleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_iconImgv.mas_right).offset(30);
        make.top.mas_equalTo(10);
    }];
    
    [_fiIconImgv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-20);
        make.top.mas_equalTo(10);
        make.width.height.mas_equalTo(25);
    }];
    
    [_priceLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_titleLbl);
        make.bottom.mas_equalTo(-15);
    }];
    
    [_numbersLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(_priceLbl);
        make.centerX.equalTo(self).offset(10);
    }];
    
    [_timeLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-15);
        make.centerY.equalTo(_priceLbl);
    }];
}

- (UIImageView *)iconImgv {
    if (!_iconImgv) {
        _iconImgv = [[UIImageView alloc] init];
        _iconImgv.backgroundColor = [UIColor orangeColor];
    }
    return _iconImgv;
}

- (UILabel *)titleLbl {
    if (!_titleLbl) {
        _titleLbl = [[UILabel alloc] init];
        _titleLbl.font = kCX_FONT(13);
        _titleLbl.text = @"标题";
    }
    return _titleLbl;
}

- (UILabel *)priceLbl {
    if (!_priceLbl) {
        _priceLbl = [[UILabel alloc] init];
        _priceLbl.font = kCX_FONT(11);
        _priceLbl.textColor = kRGB_COLOR(240, 68, 52, 1);
        _priceLbl.text = @"¥ 800";
    }
    return _priceLbl;
}

- (UILabel *)numbersLbl {
    if (!_numbersLbl) {
        _numbersLbl = [[UILabel alloc] init];
        _numbersLbl.font = kCX_FONT(11);
        _numbersLbl.text = @"游览量 30";
    }
    return _numbersLbl;
}

- (UILabel *)timeLbl {
    if (!_timeLbl) {
        _timeLbl = [[UILabel alloc] init];
        _timeLbl.font = kCX_FONT(11);
        _timeLbl.text = @"10小时前";
    }
    return _timeLbl;
}

- (UIImageView *)fiIconImgv {
    if (!_fiIconImgv) {
        _fiIconImgv = [[UIImageView alloc] init];
        _fiIconImgv.backgroundColor = [UIColor orangeColor];
    }
    return _fiIconImgv;
}


#pragma mark - 初始化
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (!self) return nil;
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    [self subviewsInContentView];
    
    return self;
}

@end
